package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.HhBrandMapper;
import com.ruoyi.system.domain.HhBrand;
import com.ruoyi.system.service.IHhBrandService;

/**
 * 商品品牌Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-06-15
 */
@Service
public class HhBrandServiceImpl implements IHhBrandService 
{
    @Autowired
    private HhBrandMapper hhBrandMapper;

    /**
     * 查询商品品牌
     * 
     * @param brandId 商品品牌ID
     * @return 商品品牌
     */
    @Override
    public HhBrand selectHhBrandById(Long brandId)
    {
        return hhBrandMapper.selectHhBrandById(brandId);
    }

    /**
     * 查询商品品牌列表
     * 
     * @param hhBrand 商品品牌
     * @return 商品品牌
     */
    @Override
    public List<HhBrand> selectHhBrandList(HhBrand hhBrand)
    {
        return hhBrandMapper.selectHhBrandList(hhBrand);
    }

    /**
     * 新增商品品牌
     * 
     * @param hhBrand 商品品牌
     * @return 结果
     */
    @Override
    public int insertHhBrand(HhBrand hhBrand)
    {
        int flag = hhBrandMapper.selecttypecount(hhBrand.getTypeId());
        if (flag<=0){
            return 0;
        }
        return hhBrandMapper.insertHhBrand(hhBrand);
    }

    /**
     * 修改商品品牌
     * 
     * @param hhBrand 商品品牌
     * @return 结果
     */
    @Override
    public int updateHhBrand(HhBrand hhBrand)
    {
        int flag = hhBrandMapper.selecttypecount(hhBrand.getTypeId());
        if (flag<=0){
            return 0;
        }
        return hhBrandMapper.updateHhBrand(hhBrand);
    }

    /**
     * 批量删除商品品牌
     * 
     * @param brandIds 需要删除的商品品牌ID
     * @return 结果
     */
    @Override
    public int deleteHhBrandByIds(Long[] brandIds)
    {
        return hhBrandMapper.deleteHhBrandByIds(brandIds);
    }

    /**
     * 删除商品品牌信息
     * 
     * @param brandId 商品品牌ID
     * @return 结果
     */
    @Override
    public int deleteHhBrandById(Long brandId)
    {
        return hhBrandMapper.deleteHhBrandById(brandId);
    }
}
